package com.borrowed.book.book.factory;

import com.borrowed.book.book.constant.BookConstant;
import com.borrowed.book.book.service.AbstractPayOrderService;
import com.borrowed.book.book.service.impl.BookPayorderServiceImpl;
import com.borrowed.book.book.service.impl.CardPayorerServiceImpl;
import com.borrowed.book.book.util.SpringContextUtils;
import org.apache.catalina.core.ApplicationContext;

/**
 * 订单处理简单工厂
 */
public class PayorderFatory {
    public static AbstractPayOrderService create(String orderType){
        AbstractPayOrderService payOrderService=null;
        switch (orderType){
            case BookConstant.RENT_ORDER:
                payOrderService= SpringContextUtils.getBean(BookPayorderServiceImpl.class);
                break;
            case BookConstant.CARD_ORDER:
                payOrderService=SpringContextUtils.getBean(CardPayorerServiceImpl.class);
                break;
        }
        return payOrderService;
    }
}
